package com.intelligencesoft.pss.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.intelligencesoft.pss.dao.PublishInfoDao;
import com.intelligencesoft.pss.entity.base.PageBean;
import com.intelligencesoft.pss.entity.base.UserInfo;
import com.intelligencesoft.pss.entity.publish.PublishInfo;

@Service
public class PublishInfoService {
	
	@Autowired
	private PublishInfoDao publishInfoDao;
	
	public void save(PublishInfo publishInfo){
		publishInfoDao.save(publishInfo);
	}
	
	public List<PublishInfo> findPublishByUserId(UserInfo userInfo){
		PublishInfo publishInfo = new PublishInfo();
		publishInfo.setUserInfo(userInfo);
		return (List<PublishInfo>)publishInfoDao.getHibernateTemplate().findByExample(publishInfo);
	}
	
	public List<PublishInfo> findPublishInfoPageData(PublishInfo publishInfo,PageBean pageBean){
		return publishInfoDao.findPublishInfoPageData(publishInfo,pageBean);
	}
	
	public Integer publishCount(PublishInfo publishInfo){
		return publishInfoDao.publishCount(publishInfo);
	}
}
